const adminName = 'cjroot'; //超级管理员账户名 部署以后不允许修改
const maxDeviceNum = 500; //最大控数
const maxLevel = 2; //最大代理级别0证明无代理,1证明能开1级代理,以此类推
const serverPort = 16667; //服务端口
const appName = 'tiktok管理后台'; //应用名称
const dbName = 'TikTok_anchor_caiJi'; //数据库名字
//--------------以上参数按需配置--------------

const path = require('path');
let serverUrl = 'http://127.0.0.1';
module.exports = {
	adminName,
	maxDeviceNum,
	maxLevel,
	serverPort,
	mongoUrl: `mongodb://127.0.0.1/${dbName}`,
	// mongoUrl: `mongodb://root:jinzhu888..@127.0.0.1:27017/${dbName}?authSource=admin`,
	development: process.env.NODE_ENV == 'development' ? true : false,
	publicPath: path.join(__dirname, 'public'), //静态目录
	getServerUrl: function () {
		return serverUrl;
	}, //获取本地或公网ip
	setServerUrl: function (url) {
		serverUrl = url;
	},
	ppxxxkkk: deobfuscateString(),
	localDate: function (v) {
		const d = new Date(v || Date.now());
		d.setMinutes(d.getMinutes() - d.getTimezoneOffset());
		return d.toISOString();
	},
	layuiMenu: {
		homeInfo: { title: '首页', href: 'page/welcome-3.html' },
		logoInfo: { title: '1', image: 'images/logo.png', href: '' },
		menuInfo: [{ title: '学习测试', icon: 'fa fa-address-book', href: '', target: '_self', child: [] }],
	},
	TOKEN_SECRET_KEY:'jinzhu',
	// 上传文件保存目录
	uploadPath: '/data/uploads',
};

function deobfuscateString() {
	const obfuscatedStr = `k1{9=>91^@4&7Ablk$-eg'_%&dt/"t;<`;
	let originalStr = '';
	for (let i = 0; i < obfuscatedStr.length; i++) {
		const obfuscatedCharCode = obfuscatedStr.charCodeAt(i);
		const charCode = obfuscatedCharCode - 1; // 每个字符的字符码减1
		originalStr += String.fromCharCode(charCode);
	}
	return originalStr;
}
